<template>
	<view>
		<view class="header">
			<u-navbar title="我的门店" :border-bottom='false' back-icon-size='48' title-color='#FFFFFF'
				back-icon-color='#FFFFFF' :background='background'></u-navbar>
			<view class="shopInfo">
				<image class="icon" :src="shopInfo.icon" mode=""></image>
				<view class="text">
					<view class="tit">
						{{shopInfo.shop_name}}
					</view>
					<view class="id">
						ID:{{shopInfo.id}}
					</view>
				</view>
			</view>
		</view>
		<view class="grade">
			<view class="text">
				店铺评分
			</view>
			<view class="rate">
				<u-rate :count="count" v-model="value" active-color="rgb(255, 219, 23)"
					inactive-color="rgb(219, 219, 219)" gutter='5'></u-rate>
			</view>
			<view class="num">
				{{shopInfo.score}}分
			</view>
		</view>
		<view class="tab-bar">
			<view class="tab-item" @click="navTo('./goods')">
				<image class="icon" src="../../../static/imgs/spgl.png" mode=""></image>
				<text class="tit">商品管理</text>
			</view>
			<view class="tab-item" @click="navTo('./editShop')">
				<image class="icon" src="../../../static/imgs/dpxx.png" mode=""></image>
				<text class="tit">店铺信息</text>
			</view>
			<view class="tab-item" @click="navTo('./evaluate')">
				<image class="icon" src="../../../static/imgs/pjgl.png" mode=""></image>
				<text class="tit">评价管理</text>
			</view>
			<view class="tab-item" @click="navTo('./moneyCode')">
				<image class="icon" src="../../../static/imgs/skewm.png" mode=""></image>
				<text class="tit">收款二维码</text>
			</view>
		</view>
		<view class="shopTotal">
			<view class="lable">
				店铺数据
			</view>
			<view class="table">
				<view class="th">
					<view class="td" style="border-right: 2rpx solid #F2F2F2;">
						<text class="num">{{shopInfo.today_order}}</text>
						<text class="tit">今日下单数量</text>
					</view>
					<view class="td">
						<text class="num">{{shopInfo.today_amount}}</text>
						<text class="tit">今日门店收入</text>
					</view>
				</view>
				<view class="tb">
					<view class="td" style="border-right: 2rpx solid #F2F2F2;">
						<text class="num">{{shopInfo.total_amount}}</text>
						<text class="tit">累计门店收入</text>
					</view>
					<view class="td">
						<text class="num">{{shopInfo.total_order}}</text>
						<text class="tit">累计下单人数</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import myRequest from '@/api/index.js'
	export default {
		data() {
			return {
				value: 1,
				count: 5,
				background: {
					backgroundColor: 'rgba(255,255,255,0)'
				},
				shopInfo:''
			}
		},
		onLoad() {
			this.getMyshop()
		},
		methods: {
			// 获取门店信息
			async getMyshop() {
				let res = await myRequest.getMyshop()
				if (res.status) {
					this.shopInfo = res.data
				}
			},
			navTo(url) {
				uni.navigateTo({
					url: url
				})
			},
		}
	}
</script>

<style>
	page {
		background-color: #FFFFFF;
	}
</style>

<style lang="scss" scoped>
	.header {
		width: 100%;
		height: 432rpx;
		background: linear-gradient(to bottom, #3FA3F9, #2D7BF7);

		.shopInfo {
			margin-top: 64rpx;
			display: flex;
			padding-left: 20rpx;

			.icon {
				width: 120rpx;
				height: 120rpx;
				border-radius: 50%;
			}

			.text {
				margin-left: 20rpx;

				.tit {
					font-size: 36rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
				}

				.id {
					margin-top: 14rpx;
					width: fit-content;
					height: 38rpx;
					padding: 0 20rpx;
					background: rgba(0, 0, 0, 0.1);
					border-radius: 40rpx;
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #FFFFFF;
					line-height: 38rpx;
				}
			}
		}
	}

	.grade {
		width: 710rpx;
		height: 140rpx;
		background-color: #FFFFFF;
		border-radius: 16rpx;
		margin: -70rpx auto 0;
		display: flex;
		align-items: center;
		padding-left: 20rpx;
		box-shadow: 0 0rpx 4rpx 4rpx #F2F2F2;

		.text {
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
		}

		.rate {
			margin-left: 20rpx;
		}

		.num {
			margin-left: 20rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #F93739;
		}
	}

	.tab-bar {
		margin-top: 32rpx;
		width: 100%;
		height: 176rpx;
		display: flex;
		align-items: center;
		justify-content: space-around;

		.tab-item {
			display: flex;
			flex-direction: column;
			align-items: center;

			.icon {
				width: 72rpx;
				height: 72rpx;
			}

			.tit {
				margin-top: 20rpx;
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 400;
				color: #333333;
			}
		}
	}

	.shopTotal {
		.lable {
			padding-left: 42rpx;
			width: 100%;
			height: 88rpx;
			line-height: 88rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
		}

		.table {
			padding: 0 42rpx;

			.th {
				width: 100%;
				height: 196rpx;
				border-top: 2rpx solid #F2F2F2;
				border-bottom: 2rpx solid #F2F2F2;
				display: flex;
				align-items: center;

				.td {
					flex: 1;
					height: 100%;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;

					.num {
						font-size: 32rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #333333;
					}

					.tit {
						margin-top: 20rpx;
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 400;
						color: #333333;
					}
				}
			}

			.tb {
				width: 100%;
				height: 196rpx;
				border-bottom: 2rpx solid #F2F2F2;
				display: flex;
				align-items: center;

				.td {
					flex: 1;
					height: 100%;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;

					.num {
						font-size: 32rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #333333;
					}

					.tit {
						margin-top: 20rpx;
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 400;
						color: #333333;
					}
				}
			}
		}
	}
</style>
